<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
</head>
<body>
  <div id="app">
    <button @click="b1 =! b1">按钮</button>
    <div v-if="b1">
      你好
    </div>
    <button  @click="a">a</button>
    <button  @click="b">b</button>
    <button  @click="c">c</button>
    <div v-if="type === 'a'">a</div>
    <div v-else-if="type ==='b' "> b</div>
    <div v-else-if="type ==='c' "> c</div>
    <div v-else>Not a/b/c</div>
     <button @click="b2 =! b2">按钮2</button>
    <template v-if="b2">
     <!-- template 相当于不占位置的 div -->
      <h1>2332</h1>
      <h1>来吧来吧</h1>
    </template>
  </div>
  <script>
    let vm = new Vue({
      el:'#app',
      data() {
        return {
          b1:false,
          type:'',
          b2:false
        }
      },
      methods: {
        a(){
          // console.log(this.type);
          this.type = 'a';
          console.log(this.type);
        },
        b(){
          this.type =''
          this.type ="b"
        },
        c(){
        this.type = 'c'
      }
      },
    })
  </script>
</body>
</html>